using System;
using System.Collections.Generic;
using System.Text;

namespace Zsa.Reflection.Discovery
{
    /// <summary>
    /// Identifies the activator for a type.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class|AttributeTargets.Assembly,
        AllowMultiple=true,Inherited=false),Serializable()]
    public class ActivationInstanceProviderAttribute :
        DiscoveryAttribute
    {
        #region Fields

        
        /// <summary>
        /// The type of the instance provider.
        /// </summary>
        private readonly Type _ProviderType;

        /// <summary>
        /// The instance type.
        /// </summary>
        private readonly Type _InstanceType;

        /// <summary>
        /// True allows the provider to be configured.
        /// </summary>
        private readonly bool _AllowConfigure = false;

        #endregion Fields

        #region Constructor

        /// <summary>
        /// Initializes a new instance of the <see cref="InstanceProviderAttribute"/> class.
        /// </summary>
        /// <param name="type">The type.</param>
        public ActivationInstanceProviderAttribute(Type instanceType, Type providerType, 
            bool allowConfigure)
        {
            _InstanceType = instanceType;
            _ProviderType = providerType;
            _AllowConfigure = allowConfigure;
        }



        #endregion Constructor
        
        #region Properties



        /// <summary>
        /// Gets a value indicating whether [allow configure].
        /// </summary>
        /// <value><c>true</c> if [allow configure]; otherwise, <c>false</c>.</value>
        public bool AllowConfigure
        {
            get
            {
                return _AllowConfigure;
            }
        }
        /// <summary>
        /// Gets the type of the instance.
        /// </summary>
        /// <value>The type of the instance.</value>
        public Type InstanceType
        {
            get
            {
                return _InstanceType;
            }
        }

        /// <summary>
        /// Gets the type of the provider.
        /// </summary>
        /// <value>The type of the provider.</value>
        public Type ProviderType
        {
            get
            {
                return _ProviderType;
            }
        
        }

        
        #endregion Properties


    }
}

